<?php

/**
 * Unit form.
 *
 * @package    ancient-wars
 * @subpackage form
 * @author     Your name here
 */
class UnitForm extends BaseUnitForm
{
  public function configure()
  {
    unset($this['created_at'], $this['updated_at'], $this['is_active']);
    $this->widgetSchema['unit_type_id'] = new sfWidgetFormChoice(array('choices' => UnitTypePeer::getUnitTypesForUserId(sfContext::getInstance()->getUser()->getAttribute("user_id", null, "sfGuardSecurityUser"))));
    $this->validatorSchema['unit_type_id'] = new sfValidatorChoice(array('choices' => array_keys(UnitTypePeer::getUnitTypesForUserId(sfContext::getInstance()->getUser()->getAttribute("user_id", null, "sfGuardSecurityUser")))));

    $this->widgetSchema['city_id'] = new sfWidgetFormInputHidden();
    $this->setDefault("city_id", $this->getOption("city_id"));
    $this->validatorSchema['city_id'] = new sfValidatorChoice(array('choices' => array($this->getOption("city_id"))));

    $this->widgetSchema['cost'] = new sfWidgetFormInputHidden();
    $this->validatorSchema['cost'] = new sfValidatorPass();
    $this->validatorSchema->setOption("allow_extra_fields", true);

    $this->widgetSchema['turn'] = new sfWidgetFormInputHidden();
  }
}
